<template>
    <div>
        <el-page-header>
            <template #breadcrumb>
                <el-breadcrumb separator="/">
                    <el-breadcrumb-item :to="{ path: 'companyhome' }">
                        企业主页
                    </el-breadcrumb-item>
                    <el-breadcrumb-item>学生评价</el-breadcrumb-item>
                </el-breadcrumb>
            </template>
        </el-page-header>
    </div><br/>
    <el-table :data="tableData" style="width: 100%" height="350">
        <el-table-column fixed prop="studentId" label="评论人编号" min-width="100" />
        <el-table-column prop="evaluationDate" label="时间" min-width="100" :formatter="formatDate" />
        <el-table-column prop="evaluationContant" label="内容" min-width="100" />
    </el-table>
    <div style="height: 140px; width: auto; border-style:dashed;border-width: 0.1px;border-color: gray;border-radius:10px;">
        <p style="text-indent: 2em; color: #545c64; size: 3px;">
            1.评价仅用于企业了解老师的指导情况以及学生的反馈；
        </p>
        <p style="text-indent: 2em; color: #545c64; size: 3px;">2.请企业严格遵守合同内容进行教学指导，密切关注学生学习情况；</p>
        <p style="text-indent: 2em; color: #545c64; size: 3px;">3·请认真维护企业的相关信息，出现更改及时联系管理员。</p>
    </div>
</template>

<script setup>
import { ref, onBeforeMount, toRefs,onBeforeUnmount,reactive } from 'vue'
import requests from '@/api/ajax.js'




/* const tableData2 = ref([{
    teacherId: '',
    teacherName: '',
    teacherPhone: '',
    companyID: '',
}])

onBeforeMount(() => {

    //请求老师信息
    const aacom = requests({ url: "/outer/campany", method: "get", }).then(res => {
        //存储用户信息到浏览器toke
        const abc = res.data
        tableData2.value = abc
        console.log(res)
    })
        .catch(err => {
            console.error(err.data);
            // 登录请求失败后的操作
        });
}) */

const tableData = ref([{
    evaluationId: '',
    companyId: '',
    evaluationContant: '',
    memberId: '',
    evaluationDate: '',
    studentId: '',
    memberState: '',
    teamId: '',
    companyName: '',
    companyInfo: '',
    companyPhone: '',
    companyTrade: '',
    companyPassword: '',
}])
onBeforeMount(() => {

//请求学生信息
const aacom = requests({ url: "/company/allStuEvaluationVo", method: "get", }).then(res => {
    //存储信息到浏览器toke
    const abc = res.rdata
    tableData.value = abc
    console.log(res)
})
    .catch(err => {
        console.error(err.data);
        // 登录请求失败后的操作
    });
})


//时间格式化
function formatDate(row, column, cellValue, index) {
    let format = 'YYYY-mm-dd'
    let date = new Date(cellValue);
    const dataItem = {
        'Y+': date.getFullYear().toString(),
        'm+': (date.getMonth() + 1).toString(),
        'd+': date.getDate().toString(),
    }
    Object.keys(dataItem).forEach((item) => {
        const ret = new RegExp(`(${item})`).exec(format);
        if (ret) {
            format = format.replace(ret[1], ret[1].length === 1 ? dataItem[item] : dataItem[item].padStart(ret[1].length, '0'));
        }
    });
    return format
}
/* const tableData = [
    {
        date: '2016-05-03',
        name: 'Tom',
        family: [
            {
                name: 'Jerry',
                state: 'California',
            },
            {
                name: 'Spike',
                state: 'California',
            },
            {
                name: 'Tyke',
                state: 'California',
            },
        ],
    },
    {
        date: '2016-05-02',
        name: 'Tom',
        family: [
            {
                name: 'Jerry',
                state: 'California',
            },
            {
                name: 'Spike',
                state: 'California',
            },
            {
                name: 'Tyke',
                state: 'California',
            },
        ],
    },
    {
        date: '2016-05-04',
        name: 'Tom',
        family: [
            {
                name: 'Jerry',
                state: 'California',
            },
            {
                name: 'Spike',
                state: 'California',
            },
            {
                name: 'Tyke',
                state: 'California',
            },
        ],
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        family: [
            {
                name: 'Jerry',
                state: 'California',
            },
            {
                name: 'Spike',
                state: 'California',
            },
            {
                name: 'Tyke',
                state: 'California',
            },
        ],
    },
    {
        date: '2016-05-08',
        name: 'Tom',
        family: [
            {
                name: 'Jerry',
                state: 'California',
            },
            {
                name: 'Spike',
                state: 'California',
            },
            {
                name: 'Tyke',
                state: 'California',
            },
        ],
    },
    {
        date: '2016-05-06',
        name: 'Tom',
        family: [
            {
                name: 'Jerry',
                state: 'California',
            },
            {
                name: 'Spike',
                state: 'California',
            },
            {
                name: 'Tyke',
                state: 'California',
            },
        ],
    },
    {
        date: '2016-05-07',
        name: 'Tom',
        family: [
            {
                name: 'Jerry',
                state: 'California',
            },
            {
                name: 'Spike',
                state: 'California',
            },
            {
                name: 'Tyke',
                state: 'California',
            },
        ],
    },
] */
</script>

<style scoped></style>